﻿@{
    ViewData["Title"] = "Index";
    Layout = "~/Areas/Console/Views/Shared/_Layout.cshtml";
}
@section head{
    <script type="text/javascript">
        var renderTable;
        layui.config({
            base: '../../layuiadmin/modules/' //静态资源所在路径
        }).extend({
            treetable: 'treetable-lay/treetable'
        }).use(['table', 'form', 'treetable'], function () {
            var $ = layui.$
                , form = layui.form
                , admin = layui.admin
                , table = layui.table
                , treetable = layui.treetable;

            // 渲染表格
            renderTable = function () {
                layer.load(2);
                treetable.render({
                    elem: '#table-datalist'
                    , treeColIndex: 4
                    , treeSpid: 0
                    , treeIdName: 'id'
                    , treePidName: 'pid'
                    , where: { type: "1" }
                    , url: '/Console/Information/GetStatistics'
                    , toolbar: '#table-datalist-toolbar'
                    , treeDefaultClose: true
                    , cols: [[
                        {
                            field: 'id', title: '序号', width: 80, templet: function (res) {
                                var str = '<span  style="line-height: 25px;display: inline-block;vertical-align: middle;margin-left: 10px;">'
                                if (res.pid == 0) {
                                    str += '<p>' + res.id + '</p>'
                                }
                                else {
                                    str += '<p></p>'
                                }
                                str += '</span>'
                                return str;
                            }
                        }
                        , { field: 'personname', title: '涉案人员' }
                        , { field: 'idCard', title: '身份证号' }
                        , { field: 'joinperson', title: '可能涉及团伙的成员' }
                        , { field: 'cause', title: '相关案件号查询' }
                        , {
                            field: 'status', title: '状态', templet: function (res) {
                                var str = '<span  style="line-height: 25px;display: inline-block;vertical-align: middle;margin-left: 10px;">未指派</span>'
                                return str;
                            }
                        }
                        , { fixed: 'right', title: '操作', toolbar: '#table-datalist-bar', width: 220 }
                    ]]
                    , page: false
                    , done: function (res) {
                        if (res.count == 0) {
                            $(".layui-table-main").html('<div class="layui-none">' + top.lang.noData + '</div>');
                        }
                        layer.closeAll('loading');
                    }
                });
            };
            renderTable();

            //监听行工具事件
            table.on('tool(table-datalist)', function (obj) {
                var data = obj.data;
                if (obj.event === 'assign') {
                    layer.open({
                        content: '功能开发中'
                        , btn: '关闭'
                        , btnAlign: 'c' //按钮居中
                        , shade: 0 //不显示遮罩
                        , yes: function () {
                            layer.closeAll();
                        }
                    });
                } else if (obj.event === 'see') {
                    layer.open({
                        content: '功能开发中'
                        , btn: '关闭'
                        , btnAlign: 'c' //按钮居中
                        , shade: 0 //不显示遮罩
                        , yes: function () {
                            layer.closeAll();
                        }
                    });
                }
            });
        });
    </script>
}
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    @*<div class="layui-card-header">菜单管理</div>*@
                    <div class="layui-card-body">
                        <table class="layui-hide" id="table-datalist" lay-filter="table-datalist"></table>
                        <script type="text/html" id="table-datalist-bar">
                            <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="assign">分派</button>
                            <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="see">查看</button>
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>